
var result="";
var carBrandname="";
var price="";
var carMatic="";
var seat="";


//事件冒泡
document.querySelector(".car-box-body").onclick = function (event){
    var ele = event.target;
    ele = ele.parentElement;//dd

    /*console.log(ele);*/
    if(ele.nodeName == 'DD'){
        //其他元素  删除样式
        var childrenEln = ele.parentElement.children;
        for(var i = 0;i<childrenEln.length;i++){
            childrenEln[i].classList.remove("on");
        }
        //当前元素添加样式
        ele.classList.add("on")

        //url拼接
        if (ele.parentElement.firstElementChild.innerText == '品牌'){
            carBrandname = ele.innerText;
        } else if (ele.parentElement.firstElementChild.innerText == '价格'){
            price = ele.innerText;
        } else if (ele.parentElement.firstElementChild.innerText == '排挡'){
            carMatic = ele.innerText;
        } else if (ele.parentElement.firstElementChild.innerText == '座位'){
            carSeatnum = ele.innerText;
        }

        result = "brand=" + carBrandname + "&price=" + price + "&gear=" + carMatic + "&seat" + carSeatnum;
        console.log("result:" + result);




    }


}



